package main

import "fmt"

type IInt interface {
	ToInt() int
}

type Person struct {
	Name string
	Age int
}

func (p Person) ToInt() int {
	return p.Age
}

type Rectangle struct {
	Width, Height int
}

func (r Rectangle) Perimeter() int {
	return 2*(r.Width+r.Height)
}

func (r Rectangle) ToInt() int {
	return r.Width*r.Height
}

type ColorRectangle struct {
	color string
	*Rectangle
}

func prints(ints []IInt) {
	for _, iint := range ints {
		fmt.Println(iint.ToInt())
	}
}

func main() {
	p:=Person{"dmmao",11}
	r:=Rectangle{10,20}
	cr:=ColorRectangle{"red",&Rectangle{30,40}}
	s:=[]IInt{p,r,cr}

	prints(s)
	fmt.Println(cr.Perimeter())
}
